<table>
    <tbody id="data-template" style="display: none">
    <tr>
        <td>
            <a class="btn btn-xs btn-primary" onclick="addNewField(this,1)">插入</a>
            <a class="btn btn-xs btn-success" onclick="addNewField(this,2)">追加</a>
            <a class="btn btn-xs btn-danger" onclick="delThisField(this,1)">删除</a>
        </td>

        <td>
            <label>
                <input class="form-control" name="field_nameFORM_INDEX[]" value="" placeholder="字段"
                >
            </label>
        </td>
        <td>
            <label>
                <input class="form-control field-type" value="" name="field_typeFORM_INDEX[]"

                       placeholder="字段类型，例如varchar(255),int(10),decimal(12,2)">
            </label>
        </td>
        <td>
            <label>
                <input class="form-control" name="form_nameFORM_INDEX[]" placeholder="名称">
            </label>
        </td>

        <td>
            <label class="bodyFormCheckbox">
                <input type="checkbox" value="1" id="is_listFORM_INDEX[]" name="is_listFORM_INDEX[]">列表
            </label>
        </td>
        <td>
            <label class="bodyFormCheckbox">
                <input type="checkbox" value="1" id="is_formFORM_INDEX[]" name="is_formFORM_INDEX[]">表单
            </label>
        </td>

        <td>
            <label class="form-type-label">
                <select class="form-control select2 form-type-select" name="form_typeFORM_INDEX[]"
                        onchange="selectField(this)">
                    <option value="text">文本[text]</option>
                    <option value="number">数字[number]</option>
                    <option value="password">密码[password]</option>
                    <option value="mobile">手机号[mobile]</option>
                    <option value="email">邮箱[email]</option>
                    <option value="id_card">身份证号[id_card]</option>
                    <option value="url">网址[url]</option>
                    <option value="ip">IP地址[ip]</option>
                    <option value="textarea">文本域[textarea]</option>
                    <option value="checkbox">复选[checkbox]</option>
                    <option value="switch">开关[switch]</option>
                    <option value="radio">单选[radio]</option>
                    <option value="select">选择列表[select]</option>
                    <option value="multi_select">多项选择列表[multi-select]</option>
                    <option value="image">图片上传[image]</option>
                    <option value="video">视频上传[video]</option>
                    <option value="multi_image">多图上传[multi-image]</option>
                    <option value="file">文件上传[file]</option>
                    <option value="multi_file">多文件上传[multi-file]</option>
                    <option value="date">日期[date]</option>
                    <option value="date_range">日期范围[date-range]</option>
                    <option value="datetime">日期时间[datetime]</option>
                    <option value="datetime_range">日期时间范围[datetime-range]</option>
                    <option value="year">年[year]</option>
                    <option value="year_range">年范围[year-range]</option>
                    <option value="year_month">年月[year-month]</option>
                    <option value="year_month_range">年月范围[year-month-range]</option>
                    <option value="map">地图选点[map]</option>
                    <option value="color">颜色选择[color]</option>
                    <option value="icon">图标选择[icon]</option>
                    <option value="editor">富文本编辑器[editor]</option>
                </select>
            </label>
        </td>

        <td class="form-validate-td">
            <label class="form-validate-label">
                <select class="form-control form-validate-select select2" multiple="multiple"
                        name="form_validateFORM_INDEX[]">
                    <option value="required">非空</option>
                    <!--当前采用微信号的规则6至20位，以字母开头，字母，数字，减号，下划线 /^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/-->
                    <option value="account">账号</option>
                    <!--验证简单中文名字2-4个汉字， /[\u4E00-\u9FA5]{2,4}/如有特殊名字请手动更改规则长度-->
                    <option value="cn_name">中文姓名</option>
                    <!--/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/-->
                    <option value="car_number">车牌号</option>
                </select>
            </label>
        </td>
        <td class="more-setting" data-id="INDEX_ID">
            <!-- 这里放更多设置
             例如：date，date_time类型的自动加时间转换功能
             is_xxx同时是switch的字段自动加is_xxx_text功能
             -->

            <a class="btn btn-default btn-sm setting-more" data-id="INDEX_ID">更多设置</a>

            <div class="extend-div" id="field_setting_div_INDEX_ID" data-id="INDEX_ID">
                <div class="box box-warning box-solid">
                    <div class="box-header with-border">
                        <h3 class="box-title">字段更多设置</h3>
                    </div>
                    <div class="box-body" id="field_setting_INDEX_ID">


                        <div class="more-from">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label for="field_defaultINEDEX_ID"></label>
                                    <input name="field_defaultFORM_INDEX[]"
                                           class="form-control input-sm"
                                           id="field_defaultINEDEX_ID" placeholder="字段默认值"
                                           title="表单内字段默认值，默认为数据库默认值，可空" data-toggle="tooltip" style="max-width: 90px">

                                </div>

                                <div class="form-group">
                                    <label for="getter_setterFORM_INDEX"></label>
                                    <select name="getter_setterFORM_INDEX[]"
                                            class="select2 form-control input-sm"
                                            id="getter_setterFORM_INDEX" data-placeholder="获取/修改器"
                                            style="width: 150px;">
                                        <option value="0">无需获取/修改器</option>
                                        <option value="switch">开关</option>
                                        <option value="date">日期</option>
                                        <option value="datetime">日期时间</option>
                                    </select>
                                </div>

                                <div class="form-group">
                                    <label for="index_searchFORM_INDEX"></label>
                                    <select name="index_searchFORM_INDEX[]"
                                            class="select2 form-control input-sm"
                                            id="index_searchFORM_INDEX" data-placeholder="列表页筛选" style="width: 150px;">
                                        <option value="0">不参与列表页筛选</option>
                                        <option value="search">关键词搜索</option>
                                        <option value="select">下拉列表筛选</option>
                                        <option value="date">日期范围筛选</option>
                                        <option value="datetime">日期时间范围筛选</option>
                                    </select>
                                </div>


                                <div class="form-group">
                                    <label for="list_sortFORM_INDEX"></label>
                                    <select name="list_sortFORM_INDEX[]"
                                            class="select2 form-control input-sm"
                                            id="list_sortFORM_INDEX" data-placeholder="列表页筛选" style="width: 150px;"
                                            title="是否参与列表排序" data-toggle="tooltip">
                                        <option value="0">不参与列表页排序</option>
                                        <option value="1">列表页面排序</option>
                                    </select>
                                </div>

                            </div>

                            <hr/>

                            <label for="field_select_dataFORM_INDEX" style="display: none"></label>
                            <textarea class="form-control input-sm" id="field_select_dataFORM_INDEX"
                                      name="field_select_dataFORM_INDEX[]"
                                      placeholder="自定义筛选/select数据，当前字段为 列表选择 的时候生效。格式为：value||name，多个选项换行即可"
                                      title="例如[性别]字段，表单是[select]形式的，数据内容为：0||保密  1||男  2||女。一定要注意value和name的分割竖线为英文竖线，非中文竖线，不同的选项一定要换行"
                                      data-toggle="tooltip"></textarea>

                            <hr/>
                            <div class="more-from">
                                <div class="form-inline">
                                    <div class="form-group">
                                        <label for="is_relationFORM_INDEX"></label>
                                        <select name="is_relationFORM_INDEX[]"
                                                class="select2 form-control input-sm"
                                                id="is_relationFORM_INDEX" data-placeholder="是否关联字段"
                                                onchange="selectRelation(this)"
                                                data-relation-table="relation_tableFORM_INDEX[]"
                                                data-relation-show="relation_showFORM_INDEX[]"
                                                style="width: 120px;">
                                            <option value="0">非关联字段</option>
                                            <option value="1">关联外键</option>
                                            <option value="2">关联主键</option>
                                        </select>
                                    </div>

                                    <div class="form-group">
                                        <select name="relation_typeFORM_INDEX[]"
                                                class="select2 form-control input-sm"
                                                id="relation_typeFORM_INDEX" title="暂时只支持一对一和一对多"
                                                data-toggle="tooltip"
                                                data-placeholder="关联方式">
                                            <option value="0">关联方式</option>
                                            <option value="1">一对多</option>
                                            <option value="2">一对一</option>

                                        </select>
                                    </div>

                                    <div class="form-group">
                                        <input readonly name="relation_showFORM_INDEX[]"
                                               class="form-control input-sm"
                                               id="relation_showINEDEX_ID"
                                               title="belongsTo填写，例如文章发布人user_id要显示成User模型的nickname，填写nickname即可"
                                               data-toggle="tooltip" placeholder="关联显示字段">
                                    </div>

                                    <div class="form-group">
                                        <input readonly name="relation_tableFORM_INDEX[]"
                                               class="form-control input-sm"
                                               id="relation_tableINEDEX_ID"
                                               title="一般此字段为表名，belongsTo的无须填写，hasOne/hasMany填写此字段，关联多个模型务必使用英文逗号隔开，例如用户关联多篇文章，多个积分记录，可以写成article,integral_log"
                                               data-toggle="tooltip" placeholder="关联表/模型,用英文逗号隔开">
                                    </div>

                                </div>
                            </div>

                            <hr/>
                            <div class="more-from">
                                <div class="form-inline">
                                    <div class="form-group">
                                        <label for="field_sceneINEDEX_ID">验证场景</label>
                                        <select name="field_sceneFORM_INDEX[]"
                                                class="select2 form-control input-sm validateScene"
                                                id="field_sceneINEDEX_ID" multiple="multiple"
                                                data-placeholder="默认选择三大模块">
                                            <option value="admin_add" selected>admin_add</option>
                                            <option value="admin_edit" selected>admin_edit</option>
                                            <option value="api_add" selected>api_add</option>
                                            <option value="api_edit" selected>api_edit</option>
                                            <option value="index_add" selected>index_add</option>
                                            <option value="index_edit" selected>index_edit</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
            </div>
        </td>
    </tr>
    </tbody>

</table>